<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main" />
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <g:set var="entityName" value="${message(code: 'estate.label', default: 'Estate')}" />
    <title>房产预警</title>
    <style>
    .contact-stat{
        padding: 8px 0px;
        text-align: center;
    }
    .contact-stat span{
        font-size: 13px;
        color: #88898c;
        margin-bottom: 10px;
    }
    .contact-stat strong{
        font-size: 13px;
        word-wrap: break-word;
    }
    .nav-tabs{
        border-bottom: none;
    }
    .hpanel > .panel-footer, .hpanel > .panel-section{
        background: #f9f9f9;
    }

    .newFontSize{
        font-size: 12px;
    }
    table>tbody>tr>td, table>tbody>tr>th,.table>tfoot>tr>td, table>tfoot>tr>th, table>thead>tr>td, table>thead>tr>th{
        padding: 8px;
        line-height: 1.42857143;
    }
    .tdColor{
        color: red !important;
    }

    </style>
</head>
<body class="fixed-navbar fixed-sidebar">

<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>预警</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                房产预警
            </h2>
        </div>
    </div>
</div>

<div class="content animate-panel">
    <div class="row">
        <g:form method="POST" action="riskWarningCollateral" class="form-horizontal" role="form" id="form">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit" id="searchBtn"><i class="fa fa-search"></i> 查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                            <i class="fa fa-times"></i> 重置</button>
                    </div>
                    查询
                </div>
                 <div class="panel-body seach-group" id="bug1">
                     <div class="row">
                        <div class="form-group col-sm-3">
                            <label  class="col-sm-3 control-label">预警编号</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" name="serialNumber" id="serialNumber" value="${params?.serialNumber}" placeholder="请输入预警编号">
                            </div>
                        </div>
                        <div class="form-group col-sm-3">
                            <label  class="col-sm-3 control-label">押品编号</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" name="externalId" id="externalId" value="${params?.externalId}" placeholder="请输入押品编号">
                            </div>
                        </div>
                        <div class="form-group col-sm-3">
                            <label  class="col-sm-3 control-label">房屋坐落</label>
                            <div class="col-sm-9">
                                <input type="text" class="form-control" name="address" id="address" value="${params?.address}" placeholder="请输入小区地址">
                            </div>
                        </div>
                    </div>
                </div>
            </g:form>
        </div>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                房产预警
            </div>
            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="estateTable">
                        <thead>
                        <tr>
                            <g:sortableColumn property="serialNumber" title="预警编号"  class=" text-center" params="${params}"/>
                            <g:sortableColumn property="externalId" title="押品编号"  class="text-center" params="${params}"/>
                            <g:sortableColumn property="buildingType" title="房屋用途"  class="text-center" params="${params}"/>
                            <g:sortableColumn property="city" title="城市"  class="text-center" params="${params}"/>
                            <g:sortableColumn property="district" title="行政区"   class="text-center" params="${params}"/>
                            <g:sortableColumn property="sourceAddress" title="房屋坐落"  class="text-center" params="${params}"/>
                            <g:sortableColumn property="buildArea" title="面积(平米)" class="text-center" params="${params}"/>
                            <g:sortableColumn property="loansAmount" title="贷款金额(元)"  class="text-center" params="${params}"/>
                            <g:sortableColumn property="loansBalance" title="贷款余额(元)"   class="text-center" params="${params}"/>
                            <g:sortableColumn property="totalPrice" title="当前估值(元)" class="text-center" params="${params}"/>
                            <g:sortableColumn property="endDate" title="押品到期日" class=" text-center" params="${params}"/>
                            <g:sortableColumn property="days" title="距离天数" params="${params}"/>
                            <g:sortableColumn property="isPass" title="是否过期" params="${params}"/>
                            <g:sortableColumn property="priceFluctuationsRatio" title="价值波动率"   class="text-center" params="${params}"/>
                            <g:sortableColumn property="workflow" title="工作流"   class="text-center" params="${params}"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${riskWarningList}">
                        <tr>
                            <td><g:link style="color: #3498DB" action="riskWarningCollateralShow" id="${it?.id}" class="firstTd">${it?.serialNumber?it?.serialNumber:'-'}</g:link></td>
                            <td>${it?.collateral?.externalId?: '-'}</td>
                            <td>${it?.collateral?.estate?.buildingType?.name}</td>
                            <td>${it?.collateral?.city?.name}</td>
                            <td>${it?.collateral?.district?.name}</td>
                            <td>${it?.collateral?.estate?.sourceAddress}</td>
                            <td>${it?.collateral?.estate?.buildArea}</td>
                            <td>${it?.collateral?.estate?.loansAmount}</td>
                            <td>${it?.collateral?.estate?.loansBalance}</td>
                            <td>${it?.collateral?.latestEvaluatePrice}</td>
                            <td><g:formatDate date="${it?.collateral?.estate?.endDate}" format="yyyy-MM-dd"></g:formatDate></td>
                            <td>${it?.collateral?.estate?.endDate - new Date()}</td>
                            <td>${it?.collateral?.estate?.endDate - new Date() < 0 ? '是' : '否'}</td>
                            <g:if test="${it?.collateral?.estate?.priceFluctuationsRatio && it?.collateral?.estate?.priceFluctuationsRatio >= 0}">
                                <td>上升 <g:formatNumber number="${it?.collateral?.estate?.priceFluctuationsRatio*100}"  type="number" minFractionDigits="2" maxFractionDigits="2" />%</td>
                            </g:if>
                            <g:elseif test="${it?.collateral?.estate?.priceFluctuationsRatio && it?.collateral?.estate?.priceFluctuationsRatio < 0}">
                                <td>下降 <g:formatNumber number="${-it?.collateral?.estate?.priceFluctuationsRatio*100}"  type="number" minFractionDigits="2" maxFractionDigits="2" />%</td>
                            </g:elseif>
                            <g:else>
                                <td>-</td>
                            </g:else>
                            <td>${it?.workflow?.name}</td>
                        </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate action="riskWarningCollateral" total="${riskWarningCount ?: 0}" params="${params}"/>
                </div>
            </div>
        </div>
    </div>

</div>

<script>
    $("#resetBtn").click(function () {
        $("#serialNumber").val("");
        $("#externalId").val("");
        $("#address").val("");
    });
</script>
</body>
</html>
